<%@ page contentType = "text/plain; charset=euc-kr" %>
<%@ page import = "model.MemberVO,java.util.List,dao.CalendarDAOImpl" %>
<%!
	CalendarDAOImpl dao = new CalendarDAOImpl();
	List<MemberVO> memberList = dao.getMemberList(1,null);
	
	
	public List search(String keyword) {
		if (keyword == null || keyword.equals("")) 
			return java.util.Collections.EMPTY_LIST;
		keyword = keyword.toUpperCase();
		List result = new java.util.ArrayList(8);
		for(MemberVO vo : memberList){
			String name = vo.getName();
			String num = vo.getNum();
			String dept_name = dao.returnMemberName(vo.getDept_code(),3);
			if (name.startsWith(keyword)) {
				result.add(name+"("+num+")-"+dept_name);
			}
		}
		return result;
	}
%>
<%
	request.setCharacterEncoding("utf-8");
	String keyword = request.getParameter("keyword");
	List keywordList = search(keyword);
	out.print(keywordList.size());
	out.print("|");
	for (int i = 0 ; i < keywordList.size() ; i++) {
		String key = (String)keywordList.get(i);
		out.print(key);
		if (i < keywordList.size() - 1) {
			out.print(",");
		}
	}
%>